package com.example.onlinemarket.bean.mobile;

import com.example.onlinemarket.bean.Good;
import com.example.onlinemarket.bean.OrderItem;

import static com.example.onlinemarket.util.FileUtil.byte2image;
import static com.example.onlinemarket.util.FileUtil.prefixPath;

public class MobileOrderedGood {
    public Integer goodId;
    public String goodName;
    public Double sellPrice;
    public String note;
    public Integer goodNum;
    public String imgPath;

    public MobileOrderedGood(Good good, OrderItem orderItem) {
        this.goodId = good.getGoodId();
        this.goodName = good.getGoodName();
        this.sellPrice = good.getSellPrice();
        this.note = orderItem.getNote();
        this.goodNum = orderItem.getGoodNUm();
        String fileName  = good.getGoodId()+".jpg";
        String path = prefixPath+"good\\"+fileName;
        byte2image(good.getPhoto(), path);
        this.imgPath="/good/"+fileName;
    }
}
